import request from '@/utils/request'

// 登录方法
export function login(username, password, code, uuid, tenantCode, verifyCode, pcDeviceId) {
  const data = {
    username,
    password,
    code,
    uuid,
    tenantCode,
    verifyCode,
    pcDeviceId,
    loginType: 'pc'
  }
  return request({
    url: '/login',
    method: 'post',
    data: data
  })
}
export function sendDeviceCode(username, verifyType) {
  return request({
    url: '/sendDeviceCode/' + username + '/' + verifyType,
    method: 'get'
  })
}

// 获取用户详细信息
export function getInfo() {
  return request({
    url: '/getInfo',
    method: 'get'
  })
}

// 获取是否多租户模式
export function getTenant() {
  return request({
    url: '/getTenant',
    method: 'get'
  })
}

// 退出方法
export function logout() {
  return request({
    url: '/logout',
    method: 'post'
  })
}

// 获取验证码
export function getCodeImg() {
  return request({
    url: '/captchaImage',
    method: 'get'
  })
}

// 公开课
export function getOpenClass(data) {
  return request({
    url: '/anxin/information/getOpenClass',
    method: 'get',
    params: data
  })
}

// 荣誉榜
export function getHonourJbs(data) {
  return request({
    url: '/anxin/information/getHonourJbs',
    method: 'get',
    params: data
  })
}

// 客户名单
export function getLogoLists(data) {
  return request({
    url: '/anxin/information/getLogoLists',
    method: 'get',
    params: data
  })
}

// 升级公告
export function getUpdateNotify(data) {
  return request({
    url: '/anxin/information/getUpdateNotifyLogin',
    method: 'get',
    params: data
  })
}

// 获取是否展示验证码
export function captchaImageShow(userName, tenantCode) {
  return request({
    url: '/captchaImageShow/' + userName + '/' + tenantCode,
    method: 'get'
  })
}

// 发送验证码
export function sendCode(userName, tenantCode) {
  const data = {
    userName,
    tenantCode
  }
  return request({
    url: '/system/pass/get/email/code',
    method: 'get',
    params: data
  })
}

// 忘记密码
export function updatePsw(userName, tenantCode, code, newPassword) {
  const data = {
    userName,
    tenantCode,
    code,
    newPassword
  }
  return request({
    url: '/system/pass/update/pass',
    method: 'put',
    data: data
  })
}

// 留言
export function recordMessage(data) {
  return request({
    url: '/anxin/information/recordMessage',
    method: 'post',
    data: data
  })
}

// 切换身份
export function changeIdentity(params) {
  return request({
    url: '/changeIdentity',
    method: 'get',
    params: params
  })
}

// 获取租户的logo和名称
export function getTenantInfo(tenantCode) {
  return request({
    url: '/companyLogo?tenantCode=' + tenantCode,
    method: 'get'
  })
}

// 获取验证码
export function generateVerificationCode(phoneNumber) {
  return request({
    url: '/base/enrollAccount/generateVerificationCode?phoneNumber=' + phoneNumber,
    method: 'get'
  })
}

// 注册
export function getRegisterLogin(fullName, manageScale, contact, phone, code, email) {
  return request({
    url: '/base/enrollAccount/getRegisterLogin?fullName=' + fullName + '&manageScale=' + manageScale + '&contact=' + contact + '&phone=' + phone + '&code=' + code + '&email=' + email,
    method: 'get'
  })
}
